<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>axios测试</title>
		<script src="../js/axios.js"></script>
	</head>
	<body>
		<h1>Axios测试案例-1</h1>
	</body>
	<script>
		/*
		var url = "http://localhost:8080/hello"
		axios.get(url).then(function(result) {// 回调函数
			console.log(result)
		})*/
		/*
			1.可以编辑Axios 发送ajax请求
			2.不同服务器之间发送ajax请求时有跨域问题
			3.解决跨域问题 通过注解解决  @CrossOrogin
			4.promise 是固定的
		*/
		let url = "http://localhost:8080/axios/getUserById"
		axios.get(url).then(function(promise) { // 回调函数
			console.log(promise.data)
		})
		
		let user1 = {age : 20,name : "join"}
		let url1 = "http://localhost:8080/axios/getUserByNA"
		axios.get(url1,{params:user1}).then(function(promise){
			console.log(promise.data);
		})
		let user2 = {age:56,name:"josn"}
		let url2 = `http://localhost:8080/axios/findUserByNs/${user2.age}/${user2.name}`
		axios.get(url2).then(promise =>
			{console.log(promise.data);}
		)

	</script>
</html>
